Skip to content

Normalize backend schedule contract - #22

Merged
blackopsrepl merged 3 commits into
mainfrom
issue-4-tauri-events
Mar 21, 2026
Merged

Normalize backend schedule contract#22
blackopsrepl merged 3 commits into
mainfrom
issue-4-tauri-events

Conversation

@blackopsrepl

Copy link
Copy Markdown
Contributor

Summary

  • Normalize backend createSchedule responses into a stable string job id contract.
  • Keep createSolver() from starting with invalid/malformed schedule responses.
  • Filter Tauri event stream payloads by active job id before delivering updates.
  • Document contract expectations in README.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

createSchedule: function (data) {
return invoke(commands.startSolve || 'create_schedule', { request: data });

P1 Badge Normalize Tauri createSchedule results before validation

createSolver.start() now rejects any non-string id in js-src/11-solver.js:27-30, but the Tauri adapter still returns the raw invoke() result here. If a Tauri command returns {id: ...}, {jobId: ...}, or a numeric id—the same shapes resolveJobId() now accepts for HTTP and that the README documents—the solve flow now fails immediately with Invalid solver backend createSchedule response and never opens the event stream.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread js-src/10-backend.js
Comment on lines 126 to +129
listen(eventName, function (event) {
onMessage(event.payload);
var payload = event && event.payload ? event.payload : {};
if (resolveEventJobId(payload) !== targetId) return;
onMessage(payload);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't unconditionally drop Tauri events without top-level ids

This filter discards every Tauri update whose job id is not exposed in one of the top-level fields that resolveEventJobId() knows about. That breaks backends that emit id-less updates for a single active run, and even payload.data.id payloads, which isEventForCurrentJob() in js-src/11-solver.js still treats as valid. In those setups the UI never receives live progress or the final NOT_SOLVING event, so the solver appears to hang until it is manually stopped.

Useful? React with 👍 / 👎.

Comment thread js-src/06-modal.js Outdated
Comment on lines +78 to +80
if (typeof content === 'string') {
target.textContent = content;
} else if (content && content.unsafeHtml) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make unsafeBody actually render trusted HTML

unsafeBody is now the documented escape hatch for modal HTML, but this helper still sends all plain strings through textContent. As a result, SF.createModal({ unsafeBody: '<b>x</b>' }) shows literal tags instead of markup, and the only working path is an undocumented { unsafeHtml: ... } wrapper object.

Useful? React with 👍 / 👎.

@blackopsrepl
blackopsrepl merged commit c27dcd5 into main Mar 21, 2026
1 check passed
@blackopsrepl
blackopsrepl deleted the issue-4-tauri-events branch March 21, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant